package com.bjpowernode.ba03;

public class Student {
    private String name;
    private int age;
    //声明一个引用数据类型
    private School school;


    public Student() {
        System.out.println("无惨构造");
    }

    //有参构造
    public Student(String myname, int age, School school) {
        System.out.println("有参构造执行");
        this.name = myname;
        this.age = age;
        this.school = school;
    }

    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", school=" + school +
                '}';
    }


    public void setSchool(School school) {
        System.out.println("setSchool:: "+school);
        this.school = school;
    }

    public void setName(String name) {
        System.out.println(name);
        this.name = name;
    }


    public void setAge(int age) {
        System.out.println(age);
        this.age = age;
    }
}
